package com.emailsystem.emailsystem.interceptor;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

@Component
public class LoginInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        //获取账户密码
        String account=request.getParameter("account");
        String password=request.getParameter("password");

        System.out.println("账户："+account+" 密码："+password);

        request.setAttribute("account",account);
        request.setAttribute("password",password);
        //放行
        return true;
    }
}
